package com.pazl.check.api.provider;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider;

import com.pazl.check.api.dto.RenterInfoDto;

public class RenterInfoGroupSequenceProvider implements DefaultGroupSequenceProvider<RenterInfoDto>{

	@Override
	public List<Class<?>> getValidationGroups(RenterInfoDto bean) {
		List<Class<?>> defaultGroupSequence = new ArrayList<Class<?>>();
		defaultGroupSequence.add(RenterInfoDto.class);
		if(bean != null){
			String marr = bean.getMarriage();
			//已婚
			if("2".equals(marr)){
				defaultGroupSequence.add(RenterInfoDto.Spouse.class);
			}else{
				defaultGroupSequence.add(RenterInfoDto.Parent.class);
			}
			String work = bean.getWork();
			//有工作
			if("1".equals(work)){
				defaultGroupSequence.add(RenterInfoDto.Work.class);
			}
			String isFirstBuy = bean.getIsFirstBuy();
			//是否家庭首次购车
			if("1".equals(isFirstBuy)){
				defaultGroupSequence.add(RenterInfoDto.FirstBuy.class);
			}
		}
		return defaultGroupSequence;
	}

}
